Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable + and - rules on mixed numeric types #787

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

oxinabox
Copy link
Member

@oxinabox oxinabox commented Mar 1, 2024

This is that constant tension in ChainRules between wanting to implement very general rules,
but not being sure you can rely on them to work for types that you can't trust to follow your epxectations.

This is the companion to JuliaDiff/Diffractor.jl#272

The version of this I have seen in the wild is calling Diffractor forwards mode over ForwardDiff,
and then getting -(::Dual, Float64) which is defined, but this can result in -(::Tangent{<:Dual}, Float64) which is not defined.

I am not convinced this is the best point to chose.
I think it might be argued that Diffractor's handling of Dual is aberant,
and it should be constructing either a Tangent which is a Dual
or it should be @opt_out frule(::typeof(-), ::Dual, Float64)

src/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
src/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
src/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
src/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
src/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
test/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
test/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
test/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
test/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
test/rulesets/Base/fastmath_able.jl Outdated Show resolved Hide resolved
oxinabox and others added 2 commits March 1, 2024 14:20
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant